import request from './request'
// import querystring from 'querystring'

// const hostName = 'http://127.0.0.1:8090/poems/' // 本地
const hostName = 'https://poems.wanjiamm.com/poems/' // 服务器

// 上传
export const uploadUrl = hostName + 'wx/upload/common/upload' // 本地上传地址
// 获取token
export const getToken = data => request.post(hostName + 'wx/login_wx', data)
//=============开始写内容==============//
// 随机一首诗经
export const getOneShijingByRound = data => request.get(hostName + 'wx/guwen/getOneShiingByRound', data)
//随机一首古诗
export const getOnePoemsByRound = data => request.get(hostName + 'wx/guwen/getOnePoemsByRound', data)
// 根据作者列出目录/词作
export const selectCountByAuthor = data => request.get(hostName + 'wx/guwen/selectCountAuthor', data)
// 根据作者列出目录/诗作
export const selectPoetryCountByAuthor = data => request.get(hostName + 'wx/guwen/selectPoetryCountAuthor', data)
// 根据作者id查找作者生平/词作
export const getPoemsAuthorById = data => request.get(hostName + `wx/guwen/getPoemsAuthorById/${data.id}`, data)
// 根据作者id查找作者生平/诗作
export const getPoetryAuthorById = data => request.get(hostName + `wx/guwen/getPoetryAuthorById/${data.id}`, data)
// 根据作者id查找作者词作
export const getPoemsByAuthor = data => request.get(hostName + `wx/guwen/getPoemsByAuthor`, data)
// 根据作者id查找作者诗作
export const getPoetryByAuthor = data => request.get(hostName + `wx/guwen/getPoetryByAuthor`, data)
//根据诗作id查找内容
export const getPoemById = data => request.get(hostName + `wx/guwen/getPoemById/${data.id}`, data)
//根据词作id查找内容
export const getPoetryById = data => request.get(hostName + `wx/guwen/getPoetryById/${data.id}`, data)

// <=================================================
// 开始写是否喜欢的部分
//获得用户是否喜欢这个作品
export const getILike = data => request.get(hostName + `wx/Like/getUserLike`, data)
//用户喜欢这个作品
export const PostILike = data => request.post(hostName + `wx/Like/like`, data)
